home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / postogrf.zip / EXTRAMEN.INC < prev    next >
Text File  |  1990-05-31  |  6KB  |  154 lines

  1. { ExtraMen.inc include file for Postogrf
  2.   14 Dec 89
  3. }
  4.  
  5. procedure ExtraMenu;
  6. const HelpStr =
  7. 'F1 expand    F2 contract    F5 rotate label           F10 VG Format';
  8.  
  9.    { -------------------------------------------------------------------
  10.       Draw box centered at screen center + (x,y).
  11.       Expand.ScrnW, Expand.ScrnH.  The size equals the (scaled down) size
  12.       that the screen will have AFTER this expansion operation is
  13.       completed.  x, y are actual screen coordinates.
  14.      ------------------------------------------------------------------- }
  15.    Procedure CenterBox(x,y:integer);
  16.    var x1, x2, y1, y2, tSF: integer;
  17.    begin
  18.       if VidCol = color then SetColor(yellow) else SetColor(white);
  19.       with Expand do begin
  20.          x1 := x + GetMaxX div 4;
  21.          y1 := y + GetMaxY div 4;
  22.          x2 := x1 + GetMaxX div 2;
  23.          y2 := y1 + GetMaxY div 2;
  24.        end;
  25.       Rectangle( x1, y1, x2, y2);
  26.    end;
  27.  
  28.   { ------------------------------------------------------------------
  29.      Show crosshairs, move them with cursor keys, to select new center
  30.      for expansion of view.  User quits with <ESC> or <CR>.
  31.      Return false if user exited by <ESC>, true otherwise.
  32.      Changes Expand.XCent, Expand.YCent.
  33.     ------------------------------------------------------------------ }
  34.    function NewCenter: boolean;
  35.    const HelpStr =
  36.        'move crosshairs to new viewpoint.  <ENTER> to change, <ESC> to quit';
  37.    var tcolor: word;
  38.        tx, ty, offset: integer;
  39.        key: char;
  40.        moving: boolean;
  41.    begin
  42.      clrscr;
  43.      Write(HelpStr);
  44.      offset := 0;
  45.      with Expand do begin
  46.         tx := 0;
  47.         ty := 0;
  48.         SetWriteMode(XorPut);
  49.         CenterBox(tx, ty);            {show box - the 1st time}
  50.         repeat
  51.            key := readkey;
  52.            moving := false;
  53.            if key = #0 then repeat
  54.                if not moving then key := readkey;
  55.                CenterBox(tx, ty);     {erase box}
  56.                case key of      {function keys}
  57.                   RightArrow: begin inc(tx);
  58.                                end;
  59.                   LeftArrow: begin dec(tx);
  60.                                end;
  61.                   UpArrow: begin dec(ty);
  62.                               end;
  63.                   DownArrow: begin inc(ty);
  64.                               end;
  65.         (* CNTRL -> *) #116: tx := tx + 10;
  66.         (* CNTRL <- *) #115: tx := tx - 10;
  67.         (* page up  *) #73 : ty := ty - 10;
  68.        (* page down *) #81 : ty := ty + 10;
  69.                       Home : begin
  70.                                 tx := 0; ty := 0;
  71.                               end;
  72.                 end; {case}
  73.                CenterBox(tx, ty);              {show box in new place}
  74.                if keypressed then begin
  75.                   repeat key := readkey; until (not keypressed) ;
  76.                   moving := true;
  77.                 end else begin
  78.                   delay(50);
  79.                   if keypressed then begin
  80.                       key := readkey; moving := true;
  81.                    end else moving := false;
  82.                  end;
  83.             until not moving ;
  84.          until (key = ESC) or (key = CR);
  85.         CenterBox(tx, ty);                       {kill box for final time}
  86.         SetWriteMode(CopyPut);
  87.          if key = CR then begin
  88.             XCent := XCent + tx div SF;
  89.             YCent := YCent + ty div SF;
  90.             NewCenter := true;
  91.           end else NewCenter := false;
  92.       end; {with Expand do...}
  93.    end; {NewCenter}
  94.  
  95. begin
  96.    clrscr;
  97.    Write(HelpStr);
  98.    repeat key := readkey;
  99.    until (key = #0) or (key = ESC) or (key = CR);
  100.    if key = #0 then key := readkey;
  101.    with Expand do
  102.    case key of      {function keys}
  103.         PF1: if NewCenter then begin
  104.                    clrscr;
  105.                    SF := SF * 2;
  106.                    ScrnW := ScrnW div 2; ScrnH := ScrnH div 2;
  107.                    ClearViewPort; RePaint;
  108.                  end;
  109.         PF2: if SF > 1 then begin
  110.                   clrscr;
  111.                   SF := SF div 2;
  112.                   ScrnW := ScrnW * 2;
  113.                   ScrnH := ScrnH * 2;
  114.                   ClearViewPort; RePaint;
  115.                end else begin
  116.                   clrscr;
  117.                   Sf := 1;
  118.                   Xcent := GetMaxX div 2; Ycent := GetMaxY div 2;
  119.                   ScrnW := GetMaxX div 2;
  120.                   ScrnH := GetMaxY div 2;
  121.                   ClearViewPort; Repaint;
  122.                 end;
  123.         PF5:  begin
  124.                   if select = nil then exit;
  125.                   select^ := tempText;
  126.                   ShowLabel(select, black);
  127.                   UnBoxLabel(select);
  128.                   ChangeDirection(select);
  129.                   tempText := select^;
  130.                   HighLight(select);
  131.                end;
  132.         PF10: begin LCOnfig.DoBar := not Lconfig.DOBar;
  133.                   if not noshow then begin
  134.                        {SetWriteMode(XORPut);}
  135.                        SetWriteMode(copyput);
  136.                        setcolor(black);
  137.                        ShowCopyBlock;
  138.                        if vidcol = color then SetColor(yellow);
  139.                    end;
  140.                    SetWriteMode(CopyPut);
  141.                    VGFormat;
  142.                    SetCopyBlockDef;
  143.                    noshow := false;
  144.                    {SetWriteMode(XORPut);}
  145.                    if vidcol = color then setcolor(yellow);
  146.                    ShowCopyBLock;
  147.                    SetWriteMode(CopyPut);
  148.                    setcolor(white);
  149.                    saved := false;
  150.                end;
  151.      end; {case}
  152.      key := #0;
  153. end;
  154.